
<include file="Public/head"/><body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                      <div class="row" id="member-summary-stats-panel">
                          <div style="margin-bottom: 10px;">
                              <ul class="nav nav-tabs">
                                  <li class=""><a href="{:U('count')}">订单统计</a></li>
                                  <li class="active"><a href="{:U('statistics')}">用户统计</a></li>
                              </ul>
                          </div>
    <div class="col-md-3">
        <div class="well">
            <b>
                今日新增
                
            </b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                <span data-bind="text: stats_today.new_member_count"><php>echo $added_day[man] + $added_day[woman];</php></span>
                <div style="font-size:13px;" class="text-muted">
                    <b class="text-warning" data-bind="text: stats_today.male_count">{$added_day.man}</b> 男性,
                    <b class="text-warning" data-bind="text: stats_today.female_count">{$added_day.woman}</b> 女性,
                </div>
            </div>
            <div style="display:none;">
                <div>
                    已付费:
                    <b class="text-warning">
                        <span data-bind="text: stats_today.paid_count">0</span>
                                            </b>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-3">
        <div class="well">
            <b>昨日新增</b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                <span data-bind="text: stats_yesterday.new_member_count"><php>echo $added_today[man] + $added_today[woman];</php></span>
                <div style="font-size:13px;" class="text-muted">
                    <b class="text-warning" data-bind="text: stats_yesterday.male_count">{$added_today.man}</b> 男性,
                    <b class="text-warning" data-bind="text: stats_yesterday.female_count">{$added_today.woman}</b> 女性,
                </div>
            </div>
            <div>
             <div style="display:none;">
                    已付费:
                    <b class="text-warning">
                        <span data-bind="text: stats_yesterday.paid_count">0</span>
                                            </b>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-3">
        <div class="well">
            <b>本月新增  <i class="fa fa-question-circle" title="不含当日，非实时，每天凌晨2:30左右更新"></i></b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                <span data-bind="text: stats_this_month.new_member_count"><php>echo $added_month[man] + $added_month[woman];</php></span>
                <div style="font-size:13px;" class="text-muted">
                    <b class="text-warning" data-bind="text: stats_this_month.male_count">{$added_month.man}</b> 男性,
                    <b class="text-warning" data-bind="text: stats_this_month.female_count">{$added_month.woman}</b> 女性,
                </div>
            </div>
            <div>
                <div style="display:none;">
                    已付费:
                    <b class="text-warning">
                        <span data-bind="text: stats_this_month.paid_count">0</span>
                                            </b>
                </div>
            </div>
        </div>
    </div>

    <div class="col-md-3">
        <div class="well">
            <b>所有时间 <i class="fa fa-question-circle" title="不含当日，非实时，每天凌晨2:30左右更新"></i></b>
            <div class="text-primary" style="font-size:32px;margin:5px 0">
                <span data-bind="text: stats_all_time.new_member_count"><php>echo $added_overall[man] + $added_overall[woman];</php></span>
                <div style="font-size:13px;" class="text-muted">
                    <b class="text-warning" data-bind="text: stats_all_time.male_count">{$added_overall.man}</b> 男性,
                    <b class="text-warning" data-bind="text: stats_all_time.female_count">{$added_overall.woman}</b> 女性,
                </div>
            </div>
            <div>
                <div style="display:none;">
                    已付费:
                    <b class="text-warning">
                        <span data-bind="text: stats_all_time.paid_count">0</span>
                                            </b>
                </div>
            </div>
        </div>
    </div>
</div>
                        <div class="panel-heading">
                            <h3 class="panel-title"><i class="fa fa-calendar"></i> 近4天充值统计</h3>
                        </div>
                       <table class="table table-bordered table-striped" data-bind="visible: !loading()">
        <thead>
            <tr>
                <th>日期</th>
                <th class="text-right">新增媒体人</th>
                                <th class="text-right">已付费</th>
                <th class="text-right">男性</th>
                <th class="text-right">女性</th>
            </tr>
        </thead>
        <tbody data-bind="foreach: stats">
            <tr>
                <td>
                    <span data-bind="date: date">{$Today}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: new_member_count"><php>echo $added_day[man] + $added_day[woman];</php></span>
                </td>
                                <td class="text-right">
                    <span data-bind="text: paid_count">0</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: male_count">{$added_day.man}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: female_count">{$added_day.woman}</span>
                </td>
            </tr>
        
            <tr>
                <td>
                    <span data-bind="date: date">{$Todaynow}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: new_member_count"><php>echo $added_today[man] + $added_today[woman];</php></span>
                </td>
                                <td class="text-right">
                    <span data-bind="text: paid_count">0</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: male_count">{$added_today.man}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: female_count">{$added_today.woman}</span>
                </td>
            </tr>
        
            <tr>
                <td>
                    <span data-bind="date: date">{$before_yesterdaynow}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: new_member_count"><php>echo $byesterday[man] + $byesterday[woman];</php></span>
                </td>
                                <td class="text-right">
                    <span data-bind="text: paid_count">0</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: male_count">{$byesterday.man}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: female_count">{$byesterday.woman}</span>
                </td>
            </tr>
        
            <tr>
                <td>
                    <span data-bind="date: date">{$days_agonow}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: new_member_count"><php>echo $user_days_ago[man] + $user_days_ago[woman];</php></span>
                </td>
                                <td class="text-right">
                    <span data-bind="text: paid_count">0</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: male_count">{$user_days_ago.man}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: female_count">{$user_days_ago.woman}</span>
                </td>
            </tr>
        
            <tr>
                <td>
                    <span data-bind="date: date">{$days_greatly}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: new_member_count"><php>echo $user_days_greatly[man] + $user_days_greatly[woman];</php></span>
                </td>
                                <td class="text-right">
                    <span data-bind="text: paid_count">0</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: male_count">{$user_days_greatly.man}</span>
                </td>
                <td class="text-right">
                    <span data-bind="text: female_count">{$user_days_greatly.woman}</span>
                </td>
            </tr>
        </tbody>
    </table>
</div> 
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        $("#tabs").tabs();
        var editor = KindEditor.create('textarea[name="content"]', {
            uploadJson: '__PUBLIC__/kindeditor/php/upload_json.php',
            fileManagerJson: '__PUBLIC__/kindeditor/php/file_manager_json.php',
            allowFileManager: true,
            afterBlur: function () {
                this.sync();
            }
        });
        $(".submit").click(function () {
            var classid = $("#class_id").val();
            var otherclassid = $("#other_class_id").val();
            var title = $("#title").val();
            var content = $("#content").val();
            var description = $("#description").val();
            if (classid == 0) {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "小说分类必须选择。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }
            if (otherclassid == 0) {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "小说特别分类必须选择。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }            
            if (title == '') {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "文章标题必须填写。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }
            if (description == '') {
                bootbox.dialog({
                    title: '友情提示：',
                    message: "小说摘要必须填写。",
                    buttons: {
                        "success": {
                            "label": "确定",
                            "className": "btn-danger"
                        }
                    }
                });
                return;
            }            
            $("#form").submit();
        });
        
        $("#class_id").change(function(){
        	var class_name = $("#class_id").find("option:selected").text();
        	class_name = class_name.replace(/-/g,"");
        	$("#class_name").val(class_name);
        });
        
        $("#other_class_id").change(function(){
        	var class_name = $("#other_class_id").find("option:selected").text();
        	class_name = class_name.replace(/-/g,"");
        	$("#other_class_name").val(class_name);
        });        
    });
</script>
</body>
</html>
